import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSCodeList } from '../../codelist/ipscode-list';
import { PSMDAjaxControlContainerImpl2 } from '../psmdajax-control-container-impl2';
import { IPSDEDataView } from './ipsdedata-view';
import { IPSDEDataViewDataItem } from './ipsdedata-view-data-item';
import { IPSDEDataViewItem } from './ipsdedata-view-item';
import { IPSLayoutPanel } from '../panel/ipslayout-panel';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysCss } from '../../res/ipssys-css';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { IPSUIActionGroup } from '../../view/ipsuiaction-group';

export class PSDEDataViewImpl extends PSMDAjaxControlContainerImpl2 implements IPSDEDataView {
  get cardColLG(): number {
    return this.M.cardColLG != null ? this.M.cardColLG : -1;
  }

  get cardColMD(): number {
    return this.M.cardColMD != null ? this.M.cardColMD : -1;
  }

  get cardColSM(): number {
    return this.M.cardColSM != null ? this.M.cardColSM : -1;
  }

  get cardColXS(): number {
    return this.M.cardColXS != null ? this.M.cardColXS : -1;
  }

  get cardHeight(): number {
    return this.M.cardHeight != null ? this.M.cardHeight : 0;
  }

  get cardWidth(): number {
    return this.M.cardWidth != null ? this.M.cardWidth : 0;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get emptyText(): string {
    return this.M.emptyText;
  }

  protected emptytextpslanguageres: IPSLanguageRes | null = null;

  getEmptyTextPSLanguageRes(): IPSLanguageRes | null {
    if (this.emptytextpslanguageres != null) return this.emptytextpslanguageres;
    const value = this.M.getEmptyTextPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.emptytextpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getEmptyTextPSLanguageRes') as IPSLanguageRes;
    return this.emptytextpslanguageres;
  }

  get emptyTextPSLanguageRes(): IPSLanguageRes | null {
    return this.getEmptyTextPSLanguageRes();
  }

  getEmptyTextPSLanguageResMust(): IPSLanguageRes {
    const value = this.getEmptyTextPSLanguageRes();
    if (value == null) {
      throw new Error('未指定无值内容语言资源');
    }
    return value;
  }

  get groupColLG(): number {
    return this.M.groupColLG != null ? this.M.groupColLG : -1;
  }

  get groupColMD(): number {
    return this.M.groupColMD != null ? this.M.groupColMD : -1;
  }

  get groupColSM(): number {
    return this.M.groupColSM != null ? this.M.groupColSM : -1;
  }

  get groupColXS(): number {
    return this.M.groupColXS != null ? this.M.groupColXS : -1;
  }

  get groupHeight(): number {
    return this.M.groupHeight != null ? this.M.groupHeight : 0;
  }

  get groupLayout(): 'ROW' | 'COLUMN' {
    return this.M.groupLayout;
  }

  get groupMode(): 'NONE' | 'AUTO' | 'CODELIST' {
    return this.M.groupMode;
  }

  protected grouppsappdefield: IPSAppDEField | null = null;

  getGroupPSAppDEField(): IPSAppDEField | null {
    if (this.grouppsappdefield != null) return this.grouppsappdefield;
    const value = this.M.getGroupPSAppDEField;
    if (value == null) {
      return null;
    }
    this.grouppsappdefield = this.getPSModel4('app.dataentity.IPSAppDEField', value, 'getGroupPSAppDEField') as IPSAppDEField;
    return this.grouppsappdefield;
  }

  get groupPSAppDEField(): IPSAppDEField | null {
    return this.getGroupPSAppDEField();
  }

  getGroupPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getGroupPSAppDEField();
    if (value == null) {
      throw new Error('未指定分组应用实体属性');
    }
    return value;
  }

  protected grouppscodelist: IPSCodeList | null = null;

  getGroupPSCodeList(): IPSCodeList | null {
    if (this.grouppscodelist != null) return this.grouppscodelist;
    const value = this.M.getGroupPSCodeList;
    if (value == null) {
      return null;
    }
    this.grouppscodelist = this.getPSModel4('codelist.IPSCodeList', value, 'getGroupPSCodeList') as IPSCodeList;
    return this.grouppscodelist;
  }

  get groupPSCodeList(): IPSCodeList | null {
    return this.getGroupPSCodeList();
  }

  getGroupPSCodeListMust(): IPSCodeList {
    const value = this.getGroupPSCodeList();
    if (value == null) {
      throw new Error('未指定分组代码表');
    }
    return value;
  }

  protected grouppssyscss: IPSSysCss | null = null;

  getGroupPSSysCss(): IPSSysCss | null {
    if (this.grouppssyscss != null) return this.grouppssyscss;
    const value = this.M.getGroupPSSysCss;
    if (value == null) {
      return null;
    }
    this.grouppssyscss = this.getPSModel4('res.IPSSysCss', value, 'getGroupPSSysCss') as IPSSysCss;
    return this.grouppssyscss;
  }

  get groupPSSysCss(): IPSSysCss | null {
    return this.getGroupPSSysCss();
  }

  getGroupPSSysCssMust(): IPSSysCss {
    const value = this.getGroupPSSysCss();
    if (value == null) {
      throw new Error('未指定分组默认界面样式');
    }
    return value;
  }

  protected grouppssyspfplugin: IPSSysPFPlugin | null = null;

  getGroupPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.grouppssyspfplugin != null) return this.grouppssyspfplugin;
    const value = this.M.getGroupPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.grouppssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getGroupPSSysPFPlugin') as IPSSysPFPlugin;
    return this.grouppssyspfplugin;
  }

  get groupPSSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getGroupPSSysPFPlugin();
  }

  getGroupPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getGroupPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定分组绘制插件');
    }
    return value;
  }

  protected grouppsuiactiongroup: IPSUIActionGroup | null = null;

  getGroupPSUIActionGroup(): IPSUIActionGroup | null {
    if (this.grouppsuiactiongroup != null) return this.grouppsuiactiongroup;
    const value = this.M.getGroupPSUIActionGroup;
    if (value == null) {
      return null;
    }
    this.grouppsuiactiongroup = this.getPSModel4('view.IPSUIActionGroup', value, 'getGroupPSUIActionGroup') as IPSUIActionGroup;
    return this.grouppsuiactiongroup;
  }

  get groupPSUIActionGroup(): IPSUIActionGroup | null {
    return this.getGroupPSUIActionGroup();
  }

  getGroupPSUIActionGroupMust(): IPSUIActionGroup {
    const value = this.getGroupPSUIActionGroup();
    if (value == null) {
      throw new Error('未指定分组界面行为组');
    }
    return value;
  }

  get groupWidth(): number {
    return this.M.groupWidth != null ? this.M.groupWidth : 0;
  }

  protected itempslayoutpanel: IPSLayoutPanel | null = null;

  getItemPSLayoutPanel(): IPSLayoutPanel | null {
    if (this.itempslayoutpanel != null) return this.itempslayoutpanel;
    const value = this.M.getItemPSLayoutPanel;
    if (value == null) {
      return null;
    }
    this.itempslayoutpanel = this.getPSModel4('control.panel.IPSLayoutPanel', value, 'getItemPSLayoutPanel') as IPSLayoutPanel;
    return this.itempslayoutpanel;
  }

  get itemPSLayoutPanel(): IPSLayoutPanel | null {
    return this.getItemPSLayoutPanel();
  }

  getItemPSLayoutPanelMust(): IPSLayoutPanel {
    const value = this.getItemPSLayoutPanel();
    if (value == null) {
      throw new Error('未指定项布局面板');
    }
    return value;
  }

  protected itempssyscss: IPSSysCss | null = null;

  getItemPSSysCss(): IPSSysCss | null {
    if (this.itempssyscss != null) return this.itempssyscss;
    const value = this.M.getItemPSSysCss;
    if (value == null) {
      return null;
    }
    this.itempssyscss = this.getPSModel4('res.IPSSysCss', value, 'getItemPSSysCss') as IPSSysCss;
    return this.itempssyscss;
  }

  get itemPSSysCss(): IPSSysCss | null {
    return this.getItemPSSysCss();
  }

  getItemPSSysCssMust(): IPSSysCss {
    const value = this.getItemPSSysCss();
    if (value == null) {
      throw new Error('未指定项默认界面样式');
    }
    return value;
  }

  protected itempssyspfplugin: IPSSysPFPlugin | null = null;

  getItemPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.itempssyspfplugin != null) return this.itempssyspfplugin;
    const value = this.M.getItemPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.itempssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getItemPSSysPFPlugin') as IPSSysPFPlugin;
    return this.itempssyspfplugin;
  }

  get itemPSSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getItemPSSysPFPlugin();
  }

  getItemPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getItemPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定项绘制插件');
    }
    return value;
  }

  get minorSortDir(): 'ASC' | 'DESC' {
    return this.M.minorSortDir;
  }

  protected minorsortpsappdefield: IPSAppDEField | null = null;

  getMinorSortPSAppDEField(): IPSAppDEField | null {
    if (this.minorsortpsappdefield != null) return this.minorsortpsappdefield;
    const value = this.M.getMinorSortPSAppDEField;
    if (value == null) {
      return null;
    }
    this.minorsortpsappdefield = this.getPSModel4('app.dataentity.IPSAppDEField', value, 'getMinorSortPSAppDEField') as IPSAppDEField;
    return this.minorsortpsappdefield;
  }

  get minorSortPSAppDEField(): IPSAppDEField | null {
    return this.getMinorSortPSAppDEField();
  }

  getMinorSortPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getMinorSortPSAppDEField();
    if (value == null) {
      throw new Error('未指定默认排序应用实体属性');
    }
    return value;
  }

  protected ordervaluepsappdefield: IPSAppDEField | null = null;

  getOrderValuePSAppDEField(): IPSAppDEField | null {
    if (this.ordervaluepsappdefield != null) return this.ordervaluepsappdefield;
    const value = this.M.getOrderValuePSAppDEField;
    if (value == null) {
      return null;
    }
    this.ordervaluepsappdefield = this.getPSModel4('app.dataentity.IPSAppDEField', value, 'getOrderValuePSAppDEField') as IPSAppDEField;
    return this.ordervaluepsappdefield;
  }

  get orderValuePSAppDEField(): IPSAppDEField | null {
    return this.getOrderValuePSAppDEField();
  }

  getOrderValuePSAppDEFieldMust(): IPSAppDEField {
    const value = this.getOrderValuePSAppDEField();
    if (value == null) {
      throw new Error('未指定排序值应用实体属性');
    }
    return value;
  }

  protected psdedataviewdataitems: IPSDEDataViewDataItem[] | null = null;

  getPSDEDataViewDataItems(): IPSDEDataViewDataItem[] | null {
    if (this.psdedataviewdataitems == null) {
      this.psdedataviewdataitems = this.fillChildListModel(this.M.getPSDEDataViewDataItems, 'control.dataview.IPSDEDataViewDataItem') as IPSDEDataViewDataItem[];
    }
    return this.psdedataviewdataitems;
  }

  get psDEDataViewDataItems(): IPSDEDataViewDataItem[] | null {
    return this.getPSDEDataViewDataItems();
  }

  findPSDEDataViewDataItem(objKey: any): IPSDEDataViewDataItem | null {
    return this.getPSModel5('control.dataview.IPSDEDataViewDataItem', this.getPSDEDataViewDataItems(), objKey) as IPSDEDataViewDataItem;
  }

  protected psdedataviewitems: IPSDEDataViewItem[] | null = null;

  getPSDEDataViewItems(): IPSDEDataViewItem[] | null {
    if (this.psdedataviewitems == null) {
      this.psdedataviewitems = this.fillChildListModel(this.M.getPSDEDataViewItems, 'control.dataview.IPSDEDataViewItem') as IPSDEDataViewItem[];
    }
    return this.psdedataviewitems;
  }

  get psDEDataViewItems(): IPSDEDataViewItem[] | null {
    return this.getPSDEDataViewItems();
  }

  findPSDEDataViewItem(objKey: any): IPSDEDataViewItem | null {
    return this.getPSModel5('control.dataview.IPSDEDataViewItem', this.getPSDEDataViewItems(), objKey) as IPSDEDataViewItem;
  }

  get pagingSize(): number {
    return this.M.pagingSize;
  }

  get hasWFDataItems(): boolean {
    return this.M.hasWFDataItems;
  }

  getHasWFDataItems(): boolean {
    return this.M.hasWFDataItems;
  }

  get appendDEItems(): boolean {
    return this.M.appendDEItems;
  }

  get enableCardEdit(): boolean {
    return this.M.enableCardEdit;
  }

  get enableCardEditGroup(): boolean {
    return this.M.enableCardEditGroup;
  }

  get enableCardEditOrder(): boolean {
    return this.M.enableCardEditOrder;
  }

  get enableCardNew(): boolean {
    return this.M.enableCardNew;
  }

  get enableGroup(): boolean {
    return this.M.enableGroup;
  }

  get enablePagingBar(): boolean {
    return this.M.enablePagingBar;
  }

  get noSort(): boolean {
    return this.M.noSort;
  }

  get singleSelect(): boolean {
    return this.M.singleSelect;
  }

  get cls(): string {
    return 'PSDEDataViewImpl';
  }

  instanceof(cls: string): boolean {
    if (
      cls == 'IPSModelObject' ||
      cls == 'IPSObject' ||
      cls == 'control.IPSAjaxControl' ||
      cls == 'control.IPSControl' ||
      cls == 'control.IPSControlContainer' ||
      cls == 'control.IPSControlNavigatable' ||
      cls == 'control.IPSMDAjaxControl' ||
      cls == 'control.IPSMDControl' ||
      cls == 'control.IPSMDControl2' ||
      cls == 'control.dataview.IPSDEDataView'
    )
      return true;
    return super.instanceof(cls);
  }
}
